window.onload = function(){
	var height = $(window).height();
	$('body').height(height);
	var height2 = $('.scrollCont').offset().top;
	$('.scrollCont').height(height - height2);
	console.log(height,height2);
	var myScroll = new IScroll('#wrapper', {
	    mouseWheel: true,
	    scrollbars: false
	});
	console.log(myScroll);
}
$(function(){
	
	$('.del').on('tap',function(){
		layer.open({
		    title: [
		      '温馨提示',
		      'background-color: #4990E2; color:#fff;'
		    ],
		    shadeClose:false
		    ,content: '<div class="data-cont">'+
			    			 '<p>是否要删除这条消息吗？</p>'+
			    		     '<div class="anniu">'+
				    		     '<a class="cancel mui-pull-left" href="javascript:;">取消</a>'+
				    		     '<span class="anniu-line"></span>'+
				    		     '<a class="confirm mui-pull-right" href="javascript:;">确定</a>'+
			    		     '</div>'+
			    		  '</div>'
		  });
		  $('.cancel').on('tap',function(){
			  	$(".layui-m-layer0").css({opacity:'0'});
				setTimeout(function(){
					var index = $('.layui-m-layer0').attr('index');
					layer.close(index);
				},500);
			})
			$('.confirm').on('tap',function(){
				var $id = $(".del").attr('dataid');
				$.post('/index/del/news',{id:$id},function (data) {
					if(data.code==200){
                        mui.alert(data.msg);
                        var index = $('.layui-m-layer0').attr('index');
                        layer.close(index);
                        setTimeout(function(){
                        	window.location.href = '/index/index/coremsg';
                        },2000);
					}else{
						mui.alert(data.msg);
					}
                });
			})
	});
})
